package controller.action;

import java.io.File;
import java.io.InputStream;

import model.service.ExamineeService;

import com.opensymphony.xwork2.ActionSupport;

public class DownloadExcel extends ActionSupport{
	private String result;
	private String Info;
	private ExamineeService examineeService;
	private InputStream inputStream;
	
	public String getResult() {
		return result;
	}
	public void setResult(String result) {
		this.result = result;
	}
	
	public void setExamineeService(ExamineeService examineeService) {
		this.examineeService = examineeService;
	}
	public void setInfo(String Info) {
		this.Info = Info;
	}
	
	
	public InputStream getInputStream() {
		return inputStream;
	}
	public String downLoad(){
		setInfo("userId#idCardNum#admitId#userName#userPhoto#userDescribe#phoneNum#mail#subject#psd#state#birthday#policy#nation#eeId");
		File file = new File(ExamineeService.basePath+"examieeExcel/");
		if(!file.exists())
		{
			file.mkdirs();
		}
		inputStream=examineeService.examieeToExcel(ExamineeService.basePath+"examieeExcel/examniee.xls", Info);
		if(inputStream==null)
			return ERROR;
		return SUCCESS;
	}
}
